home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / edit / dte5_1.zip / DTE.DOC < prev    next >
Text File  |  1991-02-06  |  22KB  |  399 lines

  1. BACKGROUND
  2. ==========
  3.  
  4. "dte" is a simple full-screen text editor suitable for editing program
  5. source code. It was designed with the following goals:
  6.     1. To perform well over slow serial communication lines;
  7.     2. To imitate the command keys used in WordStar / Turbo Pascal;
  8.     3. To be readily portable to different hardware.
  9.  
  10. Slow serial communication lines pose some unique problems for full-
  11. screen text editors. On a 1200 baud line, a 24 line by 80 column
  12. screen can take up to 16 seconds to transmit (although with normal
  13. program text 8 seconds would be more typical, since most lines will
  14. not be the full 80 columns). Most text editors simply input a command,
  15. update the screen to show the effect of the command, then input
  16. another command and so on. Usually this is acceptable. However,
  17. consider the case where the user types the command to move a page down
  18. in the file, then immediately changes his mind and types the command
  19. to move back up a page. Between when the user entered the first
  20. command and when he entered the second command, the computer might
  21. have updated one or two lines on the screen. After the second command
  22. was entered, the computer should only have had to undo these few
  23. changed lines. However, with many text editors, the computer would
  24. completely finish updating the screen before the second command was
  25. even registered, and then have to completely redraw the screen to make
  26. it the way it used to be - a total of about 16 wasted seconds for the
  27. poor user! "dte" notices commands as soon as they are typed, and
  28. always updates the screen to match the desired final state.
  29.  
  30. If the user is to be able to take full advantage of this ability to
  31. enter new commands before the screen is completely updated from
  32. earlier ones, then it would be helpful if the lines closest to the
  33. cursor could be updated before the rest of the screen; this would give
  34. the user a context in which to decide what to do next. "dte" always
  35. updates the cursor line first, and then alternately updates lines
  36. above and below the cursor until the screen is complete.
  37.  
  38. There has been much debate over whether modeless editors are
  39. intrinsically easier to use than editors with all sorts of modes. My
  40. personal view is that modes are acceptable in two situations:
  41.     1. The mode can be left set for an entire editing session;
  42.     2. The mode only lasts for the next keystroke, then reverts to
  43.        normal automatically.
  44. I believe the problems usually arise when modes last for some time,
  45. but must be changed periodically during a normal editing session. The
  46. problem is increased if the difference between what the same
  47. keystrokes achieve is drastically different between different modes.
  48.  
  49. "dte" has several modes in the first class. Insert mode determines
  50. whether normal printable characters typed will be inserted in front of
  51. the cursor, or whether they will overwrite the character under the
  52. cursor. Insert mode will usually be left on all the time, and if the
  53. user forgets which mode he is using, the worst effect will be the loss
  54. of a few characters that get overwritten by characters that were
  55. intended to be inserted. Indent mode determines whether, when the user
  56. types the carriage return key, the new line inserted will begin in
  57. column 0, or will be indented to match the line above. Indent mode
  58. will usually be left on for program editing, and if the user forgets
  59. which mode is in effect all that will be needed to correct the problem
  60. is to insert or delete a few spaces. Finally, unindent mode determines
  61. whether, when the cursor is on the first non-blank character of a line
  62. and the user types backspace, just one character should be deleted, or
  63. whether enough characters should be deleted to match the indentation
  64. of an earlier line. Unindent mode will normally be on for program
  65. editing, and if the user forgets which mode is in effect, the only
  66. problem will be a few too many or too few spaces deleted.
  67.  
  68. "dte" also has several modes in the second class. Since "dte" has over
  69. 50 different commands, it was not possible to use a different control
  70. key for each command. Therefore, some control keys have been reserved
  71. as "escape" keys, to create two-key commands. In these cases, the mode
  72. is indicated by a small marker in the top left corner of the screen,
  73. and the mode only lasts until the next single key has been pressed.
  74.  
  75. "dte" does have a few commands that do not fit either class. For
  76. example, the command to find the next occurrence of a particular
  77. string requires the user to enter the search string. In these cases,
  78. the user is prompted for whatever needs to be entered. These
  79. exceptions seem inevitable - after all, if normal characters were
  80. always inserted at the cursor, it would not (readily) be possible to
  81. search for a string containing normal characters!
  82.  
  83. Since "dte" was to be a relatively modeless editor, and yet at the
  84. same time was to work with typical so-called "intelligent" terminals,
  85. it was assumed that only printable ASCII characters and control codes
  86. could be returned by the terminal. Thus all of the "dte" commands had
  87. to be constructed from the control codes. My personal view is that
  88. MicroPro did an excellent job of this mapping with WordStar, and
  89. evidently Borland agree since the default commands for Turbo Pascal
  90. are also WordStar compatible where appropriate. Even if I had not
  91. liked this set of commands, I would still have been almost forced to
  92. use it, since most of my potential users were already familiar with
  93. Turbo Pascal.
  94.  
  95. This is the other major advantage of "dte" over the existing full-
  96. screen text editors on our UNIX minicomputer: it uses a set of
  97. commands that are already familiar to most of the staff and students
  98. from using microcomputers. For a student who normally uses Turbo
  99. Pascal on a microcomputer, and only logs in to the minicomputer to
  100. send electronic mail, it is very frustrating to have to learn a
  101. complete new set of editor commands! Many simply ignore the electronic
  102. mail facility, which makes life difficult for staff who have to try to
  103. debug programs by telephone instead!!
  104.  
  105. One of my more interesting design decisions was what to do about
  106. moving the cursor beyond the last character in a line. WordStar does
  107. not allow this (the cursor simply cannot be moved anywhere unless
  108. there is actually a character there in the text). On the other hand,
  109. Turbo Pascal permits the cursor to be placed anywhere. Since "dte" was
  110. to be a program editor, I chose the Turbo Pascal approach. However, I
  111. then had the problem of what to do about trailing white space at the
  112. end of a line. All the user has to do is type a character when the
  113. cursor is beyond the end of a line, and then delete the character
  114. again, and there will be a number of spaces hanging at the end of the
  115. line wasting memory. If this trailing space is removed as soon as the
  116. cursor leaves the line (the Turbo Pascal approach), then there is a
  117. problem: if the cursor is beyond the end of the line, and the user
  118. types the carriage return key, then changes his mind and types the
  119. backspace key, the cursor finishes up at the end of the visible text
  120. of the line, not where it started from. To avoid this, I have left the
  121. trailing space there, but removed it when starting to edit a line (by
  122. which time the cursor is already positioned). Trailing space is also
  123. removed as the file is being saved to disk. Thus, although it is
  124. possible to get some wasted memory in trailing space, the problem is
  125. not likely to accumulate over time!
  126.  
  127. Initially, "dte" did not worry about file attributes (read/write/
  128. execute) at all: if a file was read only, then after editing it had to
  129. be saved to a different name, and every file saved was simply given
  130. the default attributes. However, this caused problems with editing
  131. shell scripts, since every time a file was saved it lost its "execute"
  132. attribute! Now "dte" notes the attributes of a file when it starts
  133. editing, changes these attributes temporarily so the owner can write
  134. the file to save an edited version (if the file was read only), and
  135. finally changes the attributes back to what they wer